import com.alibaba.druid.filter.config.ConfigTools;
import org.junit.Test;

import java.util.UUID;

public class Demo {
    @Test
    public void test1() {
        for (int i = 0; i < 5; i++) {
            System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));
        }
    }

    @Test
    public void test2() {
        String code = UUID.randomUUID().toString()
                .replaceAll("-", "").substring(0, 12).toUpperCase();
        System.out.println(code.length());
    }

    @Test
    public void test3() throws Exception {
        String[] keys = ConfigTools.genKeyPair(512);
        String privateKey = keys[0];
        String publicKey = keys[1];

        String enc = ConfigTools.encrypt(privateKey, "aA123456");

        String dec = ConfigTools.decrypt(publicKey, enc);

        //MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKpUyG5IlCyaORPksQtDm08nF0FGESCIqztlAa0SnBwKIX3HCig7FwPDyqRDnZFxJXJj8YBXUbe8y/8ffXnH58cCAwEAAQ==
        System.out.println(publicKey); //
        System.out.println(enc); //EbZqF7YTVzeqEk+9EqvV2dlvqKnhrRtV+zJHky8Ui0oFMc6d3a53t7CEq45y3hx+iVQbcmQ1MAd2/mw/DI/8uQ==
        System.out.println(dec); //aA123456
    }
}
